import { PokerHand } from "./PokerHand.js";
import { PokerCard, PokerType } from "../PokerCard.js";
import { ErrorPokerHand } from "./ErrorPokerHand.js";
export type { PokerCard, PokerType } from "../PokerCard.js";

/** 火箭类型 */
export class RocketPokerHand extends PokerHand {
  constructor(cards: PokerCard[]) {
    super(cards);
  }
  public value = 15;
  /**
   * 判断是否为火箭：即双王（大王和小王），最大的牌
   * @param cards 手牌
   * @returns
   */
  public static isStandard(cards: PokerCard[]) {
    if (cards.length !== 2) {
      return false;
    }

    return cards.every((card) => card.type === PokerType.joker);
  }
  public isStandard = RocketPokerHand.isStandard;
  public isBetter(target: PokerHand) {
    if (target instanceof ErrorPokerHand) {
      return false;
    }
    return true;
  }
}

export default RocketPokerHand;
